package com.study.example.ex02;

import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;

import org.junit.Test;

/**
* @Name: MyLineNumberReaderTest
* @Description: 自定义跟踪行号的缓冲字符输入流测试类
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-1-16 下午3:58:14 
* @Version: V1.0
 */
public class MyLineNumberReaderDemo {

	@Test
	public void setGetReadLine() throws IOException {
		MyLineNumberReader reader = new MyLineNumberReader(new FileReader("sort.txt")) ;
		String line = null ;
		//设置开始行号
		reader.setLineNumber(10) ;
		while((line = reader.readLine()) != null) {
			//获取每行的行号
			System.out.println(reader.getLineNumber() + ":" +line);
		}
		reader.close() ;
	}
	
}
